import time

ans = 0  # 方案数


def dfs(depth, n, m):  # 每一层都有枚举
    # depth 第几个小朋友
    # n,m为剩余量
    if depth == 7:  # 不管还剩多少,dfs都结束了,如果剩余为零则说明ans加一
        if n == 0 and m == 0:
            global ans
            ans += 1
            print(ans)
        return
    for i in range(0, 6):
        for j in range(0, 6):  # i+j是第一个小朋友的全部糖
            if 2 <= i + j <= 5 and i <= n and j <= m:
                if n - i == 0 and m - j == 0:
                    print(i, j, depth + 1)
                    time.sleep(5)
                dfs(depth + 1, n - i, m - j)


dfs(0, 9, 16)
print(ans)

# 5067671
